package ink.lovejinhu.swardToOffer;

import ink.lovejinhu.common.TreeNode;

public class Offer_027 {

    public TreeNode mirrorTree(TreeNode rootNode) {
       return this.buildTree(rootNode);

    }

    public TreeNode buildTree(TreeNode rootNode) {
        if (rootNode == null) {
            return null;
        }
        TreeNode tempNode = rootNode.left;
        rootNode.left = rootNode.right;
        rootNode.right = tempNode;
        buildTree(rootNode.left);
        buildTree(rootNode.right);
        return rootNode;

    }
}
